<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="OptParse.Formatter.html">
<link rel="Up" href="OptParse.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Base64" rel="Chapter" href="Base64.html">
<link title="BitSet" rel="Chapter" href="BitSet.html">
<link title="Dllist" rel="Chapter" href="Dllist.html">
<link title="DynArray" rel="Chapter" href="DynArray.html">
<link title="Enum" rel="Chapter" href="Enum.html">
<link title="ExtArray" rel="Chapter" href="ExtArray.html">
<link title="ExtHashtbl" rel="Chapter" href="ExtHashtbl.html">
<link title="ExtLib" rel="Chapter" href="ExtLib.html">
<link title="ExtList" rel="Chapter" href="ExtList.html">
<link title="ExtString" rel="Chapter" href="ExtString.html">
<link title="Global" rel="Chapter" href="Global.html">
<link title="IO" rel="Chapter" href="IO.html">
<link title="OptParse" rel="Chapter" href="OptParse.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="PMap" rel="Chapter" href="PMap.html">
<link title="RefList" rel="Chapter" href="RefList.html">
<link title="Std" rel="Chapter" href="Std.html">
<link title="UChar" rel="Chapter" href="UChar.html">
<link title="UTF8" rel="Chapter" href="UTF8.html">
<link title="Unzip" rel="Chapter" href="Unzip.html"><link title="Exceptions" rel="Section" href="#6_Exceptions">
<link title="Types" rel="Section" href="#6_Types">
<link title="Option parser creation" rel="Section" href="#6_Optionparsercreation">
<link title="Output and error handling" rel="Section" href="#6_Outputanderrorhandling">
<link title="Option parsing" rel="Section" href="#6_Optionparsing">
<title>OptParse.OptParser</title>
</head>
<body>
<div class="navbar"><a class="pre" href="OptParse.Formatter.html" title="OptParse.Formatter">Previous</a>
&nbsp;<a class="up" href="OptParse.html" title="OptParse">Up</a>
&nbsp;</div>
<h1>Module <a href="type_OptParse.OptParser.html">OptParse.OptParser</a></h1>
<pre><span class="keyword">module</span> OptParser: <code class="code">sig</code> <a href="OptParse.OptParser.html">..</a> <code class="code">end</code></pre><div class="info">
This module contains the option parser itself.
<p>

  It provides functions to create, populate and use option parsers to
  parse command line arguments.<br>
</div>
<hr width="100%">
<br>
<h6 id="6_Exceptions">Exceptions</h6><br>
<pre><span id="EXCEPTIONOption_conflict"><span class="keyword">exception</span> Option_conflict</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info">
<code class="code">Option_conflict name</code> is raised by <a href="OptParse.OptParser.html#VALadd"><code class="code">OptParse.OptParser.add</code></a>
      when two different options are added with identical
      names. Usually this doesn't need to be caught since this error
      is usually easily fixed permanently by removing/renaming the
      conflicting option names.<br>
</div>
<br>
<h6 id="6_Types">Types</h6><br>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre>
<div class="info">
The type of an option parser.<br>
</div>

<pre><span id="TYPEgroup"><span class="keyword">type</span> <code class="type"></code>group</span> </pre>
<div class="info">
The type of an option group.<br>
</div>

<br>
<h6 id="6_Optionparsercreation">Option parser creation</h6><br>
<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">?usage:string -><br>       ?description:string -><br>       ?version:string -><br>       ?suppress_usage:bool -><br>       ?suppress_help:bool -><br>       ?prog:string -><br>       ?formatter:<a href="OptParse.Formatter.html#TYPEt">OptParse.Formatter.t</a> -> unit -> <a href="OptParse.OptParser.html#TYPEt">t</a></code></pre><div class="info">
Creates a new option parser with the given options.<br>
<b>Returns</b> the new option parser.<br>
</div>
<div class="param_info"><code class="code">usage</code> : Usage message. The default is a reasonable usage
      message for most programs. Any occurrence of the substring
      <code class="code">"%prog"</code> in <code class="code">usage</code> is replaced with the name of the program
      (see <code class="code">prog</code>).</div>
<div class="param_info"><code class="code">version</code> : Version string. If set, a '--version' option is
      automatically added. When encountered on the command line it
      causes <code class="code">version</code> to be printed to the standard output and the
      program to exit.</div>
<div class="param_info"><code class="code">suppress_usage</code> : Suppress the usage message if set.</div>
<div class="param_info"><code class="code">suppress_help</code> : Suppress the 'help' option which is
      otherwise added by default.</div>
<div class="param_info"><code class="code">prog</code> : Program name. The default is the base name of the
      executable.</div>
<pre><span id="VALadd"><span class="keyword">val</span> add</span> : <code class="type"><a href="OptParse.OptParser.html#TYPEt">t</a> -><br>       ?group:<a href="OptParse.OptParser.html#TYPEgroup">group</a> -><br>       ?help:string -><br>       ?hide:bool -><br>       ?short_name:char -><br>       ?short_names:char list -><br>       ?long_name:string -> ?long_names:string list -> 'a <a href="OptParse.Opt.html#TYPEt">OptParse.Opt.t</a> -> unit</code></pre><div class="info">
Add an option to the option parser.<br>
<b>Raises</b> <code>Option_conflict</code> if the short name(s) or long name(s)
      have alread been used for some other option.<br>
</div>
<div class="param_info"><code class="code">help</code> : Short help message describing the option (for the usage message).</div>
<div class="param_info"><code class="code">hide</code> : If true, hide the option from the usage
      message. This can be used to implement "secret" options which
      are not shown, but work just the same as regular options in all
      other respects.</div>
<div class="param_info"><code class="code">short_name</code> : is the name for the short form of the option
      (e.g. <code class="code">'x'</code> means that the option is invoked with <code class="code">-x</code> on the
      command line).</div>
<div class="param_info"><code class="code">short_names</code> : is a list of names for the short form of the
      option (see <code class="code">short_name</code>).</div>
<div class="param_info"><code class="code">long_name</code> : is the name for the long form of the option
      (e.g. <code class="code">"xyzzy"</code> means that the option is invoked with <code class="code">--xyzzy</code>
      on the command line).</div>
<div class="param_info"><code class="code">long_names</code> : is a list of names for the long form of the
      option (see <code class="code">long_name</code>).</div>
<pre><span id="VALadd_group"><span class="keyword">val</span> add_group</span> : <code class="type"><a href="OptParse.OptParser.html#TYPEt">t</a> -><br>       ?parent:<a href="OptParse.OptParser.html#TYPEgroup">group</a> -><br>       ?description:string -> string -> <a href="OptParse.OptParser.html#TYPEgroup">group</a></code></pre><div class="info">
Add a group to the option parser.<br>
<b>Returns</b> the new group.<br>
</div>
<div class="param_info"><code class="code">parent</code> : is the parent group (if any).</div>
<div class="param_info"><code class="code">description</code> : is a description of the group.</div>
<br>
<h6 id="6_Outputanderrorhandling">Output and error handling</h6><br>
<pre><span id="VALerror"><span class="keyword">val</span> error</span> : <code class="type"><a href="OptParse.OptParser.html#TYPEt">t</a> -><br>       ?chn:Pervasives.out_channel -> ?status:int -> string -> 'a</code></pre><div class="info">
Display an error message and exit the program. The error
      message is printed to the channel <code class="code">chn</code> (default is
      <code class="code">Pervasives.stderr</code>) and the program exits with exit status
      <code class="code">status</code> (default is 1).<br>
</div>
<pre><span id="VALusage"><span class="keyword">val</span> usage</span> : <code class="type"><a href="OptParse.OptParser.html#TYPEt">t</a> -> ?chn:Pervasives.out_channel -> unit -> unit</code></pre><div class="info">
Display the usage message to the channel <code class="code">chn</code> (default is
      <code class="code">Pervasives.stdout</code>) and return.<br>
</div>
<br>
<h6 id="6_Optionparsing">Option parsing</h6><br>
<pre><span id="VALparse"><span class="keyword">val</span> parse</span> : <code class="type"><a href="OptParse.OptParser.html#TYPEt">t</a> -><br>       ?first:int -> ?last:int -> string array -> string list</code></pre><div class="info">
Parse arguments as if the arguments <code class="code">args.(first)</code>,
      <code class="code">args.(first+1)</code>, ..., <code class="code">args.(last)</code> had been given on the
      command line. By default <code class="code">first</code> is 0 and <code class="code">last</code> is the index
      of the last element of the array.<br>
</div>
<pre><span id="VALparse_argv"><span class="keyword">val</span> parse_argv</span> : <code class="type"><a href="OptParse.OptParser.html#TYPEt">t</a> -> string list</code></pre><div class="info">
Parse all the arguments in <code class="code">Sys.argv</code>.<br>
</div>
</body></html>